﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Chapter19.View
{
    using Chapter19.ViewModel;
    using System.Data;

    /// <summary>
    /// BindProductObject.xaml 的交互逻辑
    /// </summary>
    public partial class BindProductObjectWindow : Window
    {
        public BindProductObjectWindow()
        {
            InitializeComponent();
        }

        private void getDataButton_Click(object sender, RoutedEventArgs e)
        {
            int id;
            if (int.TryParse(idTextBox.Text, out id))
            {
                try
                {
                    infoGrid.DataContext = App.StoreDB.GetProduct(id);
                }
                catch
                {
                    MessageBox.Show("没有这项id");
                }
            }
            else
            {
                MessageBox.Show("请输入数字");
            }
        }
    }
}
